package com.wenhao.newcode.pinduoduo.hard2021;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-25 11:33
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        if (N > 45) {
            System.out.println(-1);
            return;
        }
        String s = "";
        int digit = 9;
        while (N > digit) {
            s = digit + s;
            N -= digit;
            digit--;
        }
        if (N > 0) {
            s = N + s;
        }
        System.out.println(s);
    }
}
